<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex IncomeDetail_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub IncomeDetail_fd0_0'>
					<view class='flex align-center IncomeDetail_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  IncomeDetail_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex align-center'>
						<text class='IncomeDetail_fd0_0_c1_c0'>收益明细</text>
					</view>
					<view class='flex align-center justify-end IncomeDetail_fd0_0_c0'>
						<image class='IncomeDetail_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"309.png"'
							@tap.stop="popupShow1691659233892=true"></image>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#3090FF"></u-loading>
				<view>加载中</view>
			</view>
			
			<!---收益明细-收益flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout" v-else>
				<!-- <view>
					<benben-flex-tabs class-name='IncomeDetail_benbenTabsfd1_0' v-model="tabs" ref="benben_tabsfd1_0"
						select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false'
						:open-sticky='true' :top='88' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_0" @change="queryListFunc()">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true"
							:scroll-left.sync="tabsInfofd1_0.moveX" scroll-with-animation="all .3s ease">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_0': tabs == 'all', 'flex flex-wrap align-center': true }"
										@tap="tabs = 'all'" :id="`benben_tabsfd1_0-title-item-${'all'}`">

										<text class='IncomeDetail_titleItemfd1_0_c3_c0'>全部</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == 'unsettle', 'flex flex-wrap align-center': true }"
										@tap="tabs = 'unsettle'" :id="`benben_tabsfd1_0-title-item-${'unsettle'}`">

										<text>待结算</text>

									</view>
									<view
										:class="{ 'checkTitlefd1_0': tabs == 'settled', 'flex flex-wrap align-center': true }"
										@tap="tabs = 'settled'" :id="`benben_tabsfd1_0-title-item-${'settled'}`">

										<text>已结算</text>

									</view>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line IncomeDetail_linefd1_0"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view> -->
				<view class='flex flex-wrap align-center IncomeDetail_fd1_1' v-if="start_time || end_time">
					<image class='IncomeDetail_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"509.png"'></image>
					<text class='IncomeDetail_fd1_1_c1'>{{start_time}}--{{end_time}}</text>
					<text class='fu-iconfont2  IncomeDetail_fd1_1_c2' @tap.stop="closeDate">&#xe66f;</text>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch IncomeDetail_fd1_2'>
					<template v-for='(child,key1) in list'>
						<view class='flex flex-direction flex-wrap align-stretch IncomeDetail_fd1_2_c0' :key='key1'>
							<view class='flex flex-wrap align-center justify-between IncomeDetail_fd1_2_c0_c0'>
								<text class='IncomeDetail_fd1_2_c0_c0_c0'>{{child.show_time}}</text>
								<text class='IncomeDetail_fd1_2_c0_c0_c1'></text>
							</view>
							<view class='flex flex-wrap align-center IncomeDetail_fd1_2_c0_c1'>
								<text class='IncomeDetail_fd1_2_c0_c1_c0'>{{$t('收益金额：')}}</text>
								<text class='IncomeDetail_fd1_2_c0_c1_c0'>{{$t('￥')}}</text>
								<text class='flex-sub IncomeDetail_fd1_2_c0_c1_c0'>{{child.change_money}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='IncomeDetail_fd1_2_c0_c2_c0'>{{$t('订单编号：')}}</text>
								<text class='IncomeDetail_fd1_2_c0_c2_c0'>{{child.order_sn}}</text>
							</view>
							<view class='flex flex-wrap align-center IncomeDetail_fd1_2_c0_c3'>
								<text class='IncomeDetail_fd1_2_c0_c2_c0'>{{$t('订单金额：')}}</text>
								<text class='IncomeDetail_fd1_2_c0_c2_c0'>{{$t('￥')}}</text>
								<text class='IncomeDetail_fd1_2_c0_c2_c0'>{{child.order_money}}</text>
							</view>
							<view class='flex flex-wrap align-center IncomeDetail_fd1_2_c0_c4'>
								<view>
									<text class='IncomeDetail_fd1_2_c0_c4_c0_c0'>{{child.remark}}</text>
								</view>
							</view>
						</view>
					</template>
					<view class="loadmore" v-if="last_page > 1">
						<u-loadmore font-size="24" :status="status" :icon-type="iconType" :load-text="loadText" />
					</view>
				</view>
				<view class="noData" v-if="list.length == 0 && !isShow">
					<image :src='STATIC_URL+"no.png"'></image>
				</view>
			</view>

			<!---收益明细-收益flex布局结束-->
			<benben-popup v-model="popupShow1691659233892" :mask="true" :mask-close-able="true" mode='center'>
				<!---flex布局flex布局开始-->
				<view class="flex benben-flex-layout flex-wrap align-center">
					<benben-calendar-diy mode='range' year-arrow-color='#666666' month-arrow-color='#666666'
						start-text=' ' end-text=' ' active-bg-color='rgba(41,121,255,1)'
						range-bg-color='rgba(41,121,255,0.13)' :change-title='true' :change-year='true'
						:change-month='true' class='IncomeDetail_fd2_0' @change="initialization"
						:start-time.sync="start_time" :end-time.sync="end_time"></benben-calendar-diy>
				</view>

				<!---flex布局flex布局结束-->

			</benben-popup>


		</view>
	</view>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"popupShow1691659233892": false,
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0
				},
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"tabs": "all",
				"start_time": "",
				"end_time": "",
				"type": "",  // 1今天  2当月  3全部
				
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				type
			} = options
			if (type !== undefined) this.type = type;
			this.dateTransFunc();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			//获取本月时间
			dateTransFunc() {
				if (this.type != '') {
					let date = new Date()
					let year = date.getFullYear();
					let month = date.getMonth() + 1;
					let day = date.getDate();

					month = (month > 9) ? month : ("0" + month);
					day = (day < 10) ? ("0" + day) : day;
					this.end_time = year + "-" + month + "-" + day;
					if (this.type == '1') {
						this.start_time = this.end_time
					} else if (this.type == '2') {
						this.start_time = year + "-" + month + "-01";
					} else if (this.type == '3') {
						this.start_time = "";
						this.end_time = "";
					}
				}
				this.getList();
			},
			getList() {
				this.$api.post(global.apiUrls.post658aa84291b62, {
					page: this.page,
					start_time: this.start_time,
					end_time: this.end_time
				}).then(res => {
					uni.stopPullDownRefresh();
					this.isShow = false;
					// console.log(res);
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			closeDate() {
				this.start_time = "";
				this.end_time = "";
				this.page = 1;
				this.is_pull = true;
				this.isShow = true;
				this.getList();
			},
			initialization() {
				this.popupShow1691659233892 = false;
				this.page = 1;
				this.is_pull = true;
				this.isShow = true;
				this.getList();
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.IncomeDetail_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.IncomeDetail_fd0_0_c2_c0 {
		width: 36rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.IncomeDetail_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.IncomeDetail_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.IncomeDetail_fd0_0_c0 {
		width: 180rpx;
	}

	.IncomeDetail_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.IncomeDetail_fd1_2_c0_c4_c0_c0 {
		color: var(--benbenFontColor0);
		font-size: 24rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.IncomeDetail_fd1_2_c0_c4 {
		margin: 32rpx 0rpx 32rpx 0rpx;
		color: var(--benbenFontColor0);
	}

	.IncomeDetail_fd1_2_c0_c3 {
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		margin: 16rpx 0rpx 0rpx 0rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
	}

	.IncomeDetail_fd1_2_c0_c2_c0 {
		color: #666666;
		font-size: 22rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.IncomeDetail_fd1_2_c0_c1_c0 {
		color: #333333;
		font-size: 22rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.IncomeDetail_fd1_2_c0_c1 {
		margin: 16rpx 0rpx 16rpx 0rpx;
	}

	.IncomeDetail_fd1_2_c0_c0_c1 {
		font-size: 28rpx;
		color: rgba(255, 103, 86, 1);
	}

	.IncomeDetail_fd1_2_c0_c0_c0 {
		font-size: 24rpx;
		color: rgba(153, 153, 153, 1);
	}

	.IncomeDetail_fd1_2_c0_c0 {
		border-bottom: 1px solid #eee;
		padding: 0rpx 0rpx 24rpx 0rpx;
	}

	.IncomeDetail_fd1_2_c0 {
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 32rpx 24rpx 0rpx 24rpx;
		margin: 0rpx 0rpx 20rpx 0rpx;
	}

	.IncomeDetail_fd1_2 {
		padding: 0rpx 24rpx 0rpx 24rpx;
		margin-top: 24rpx;
	}

	.IncomeDetail_fd1_1_c2 {
		font-size: 26rpx;
	}

	.IncomeDetail_fd1_1_c1 {
		font-size: 28rpx;
		font-weight: 500;
		margin: 0rpx 12rpx 0rpx 12rpx;
	}

	.IncomeDetail_fd1_1_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.IncomeDetail_fd1_1 {
		padding: 32rpx 0rpx 0rpx 24rpx;
	}

	.IncomeDetail_titleItemfd1_0_c3_c0 {
		color: var(--benbenFontColor0);
	}

	.IncomeDetail_linefd1_0 {
		background: var(--benbenbgColor0);
		width: 40rpx;
		height: 8rpx;
		top: 80rpx;
		background-size: 100% auto !important;
		border-radius: 16rpx;
	}

	.checkTitlefd1_0 {
		font-weight: 700 !important;
		font-size: 28rpx !important;
		color: #101010 !important;
		background-color: rgba(255, 255, 255, 1) !important;
	}

	::v-deep .IncomeDetail_benbenTabsfd1_0 {
		background: var(--benbenbgColor1);
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		text-align: center;
		font-size: 32rpx;
		font-weight: 400;
		color: rgba(167, 166, 167, 1);
	}

	.IncomeDetail_fd2_0 {
		background: #ffffff;
		width: 622rpx;
		border-radius: 24rpx;
		padding: 12rpx 012rpx 012rpx 012rpx;
	}
</style>